function LinkAndBox(name, param, msg){
	/*couples link name+l and box name+l
		so that when link is clicked, value of the box is 
		appended to the request as a parameter param */
	/*this.link = document.all(name + 'l');*/

	this.link = document.getElementById(name + 'l');

	
	if (!this.link) return;
	/*this.box = document.all(name + 'b');*/

	this.box = document.getElementById(name + 'b');

	if (!this.box) return;


	this.link.lb = this;
	this.box.lb = this;
	this.msg = msg;
	this.param = param;
	this.link.onclick = _link_onclick;
	this.box.onkeypress = _box_onkeypress;

}

function _link_onclick() {

	var id = this.lb.box.value;		

	if (id == "") {
		alert(this.lb.msg);
		this.lb.box.focus();
		return false;
	}

	var url = this.href;

	if (this.lb.param == 'id')
		url = url + '/' + id;
	else {
		var sep = '?';
		if (this.href.indexOf('?') > 0) sep = '&';
		url = url + sep + this.lb.param + '=' + id;
	}

	window.location.href = url;
	return false;

}

function _box_onkeypress(event) {
	var keyCode = event.which ? event.which : event.keyCode;
	//alert(keyCode);	
	if (keyCode==13) this.lb.link.onclick();

}

